package com.example.demo.mapper;

import com.example.demo.entity.Idea;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface IdeaMapper {

    @Select("select * from idea where ideaid=#{ideaid}")
    public abstract List<Idea> findideaone(int ideaid);

    //搜索全部idea
    @Select("select * from idea")
    public abstract List<Idea> selectAll();

    @Insert("INSERT INTO idea(title,openid,pictureroute,ideacontent,tumbupnumber,ideadate)" +
            "values(#{title},#{openid},#{pictureroute},#{ideacontent},#{tumbupnumber},#{ideadate})")
    public int InsertIdea(Idea idea);

    //更改点赞数
    @Update("update idea set tumbupnumber=#{tumbupnumber} where ideaid=#{ideaid}")
    public int updatacomment(int tumbupnumber,int ideaid);
}
